package wsz;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.concurrent.CompletableFuture;

/**
 * TODO：通过xml配置文件，开启dubbo异步调用接口
 *
 * @author wsz
 * @desc：
 * @date 2021/12/13
 */
public class AsyncXmlTest {
    public static void main(String[] args) throws Exception {
        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("consumer.xml");
        AsyncService service = applicationContext.getBean(AsyncService.class);
        while(true) {
            System.in.read();
            // 消费端默认超时1000
            CompletableFuture<String> future = service.sayHello("wwww", 2000);
            System.out.println("result=" + future);
            System.out.println("future=" + future.get());
            System.out.println("future after");
        }
    }
}
